# -*- coding:utf-8 -*-
# editor: zzh
# date: 2022/9/15

import json
import pickle

# json_data1 = json.load(open('9_13_163.json', encoding='utf8'))
# json_data2 = json.load(open('8_25_137.json', encoding='utf8'))
#
# print(len(json_data1), len(json_data2))
# json_data = json_data1 + json_data2
# print(len(json_data))
#
# train_data = json_data[:240]
# test_data = json_data[240:]
#
# json.dump(train_data, open('train.json','w',encoding='utf8'))
# json.dump(test_data, open('test.json','w',encoding='utf8'))
#
# data = json.load(open('train.json',encoding='utf8'))

# prop2id = {'NA':0}
# for d in json_data1:
#     for sent in d['dialogue']:
#         for info in sent['info']:
#             p = info['prop']
#             if p not in prop2id:
#                 prop2id[p] = len(prop2id)
#
# print(sorted(prop2id, key=lambda x:x[0]))
# print(prop2id)
# pickle.dump(prop2id, open('prop2id.pkl','wb'))

datas = json.load(open('500.json', encoding='utf8'))

# for d in datas:
#     print(d)

train_len = int(len(datas)*4/5)
print(train_len)

# train_data = datas[:train_len]
# test_data = datas[train_len:]
#
# json.dump(train_data, open('train_500.json','w',encoding='utf8'))
# json.dump(test_data, open('test_500.json','w',encoding='utf8'))


